import request from '@/utils/request';

// 轮播图列表
interface fetchSlideListProps {
  current: number;
}
export const fetchSlideList = (data: fetchSlideListProps) => {
  return request('/admin/slides', {
    method: 'GET',
    data,
  });
};

// 禁用和启用
export const fetchSlideSwitch = (id: number) => {
  return request(`/admin/slides/${id}/status`, {
    method: 'PATCH',
  });
};

// 删除
export const fetchSlideDelete = (id: number) => {
  return request(`/admin/slides/${id}`, {
    method: 'DELETE',
  });
};

// 添加
export const fetchSlideAdd = (data: any) => {
  return request('/admin/slides', {
    method: 'POST',
    data,
  });
};

// 编辑
export const fetchSlideEdit = (id: number, data: any) => {
  return request(`/admin/slides/${id}`, {
    method: 'PUT',
    data,
  });
};

// 修改排序
export const fetchSlideSeq = (id: number, data: any) => {
  return request(`/admin/slides/${id}/seq`, {
    method: 'PATCH',
    data,
  });
};
